/* *******************************************************************************
  描述：定义所有的错误代码。                                                          *
                                                                                 *
  作者：宋炜
  单位：西咸新区斯马特智能照明科技有限公司

  日期：2015-7-21
  版本：1.0

  相关文件：

  修改记录：
 *********************************************************************************/

#ifndef __ERROR_CODE_H__
#define __ERROR_CODE_H__

#define ERROR_BASE                      -1
#define FATAL_BASE                      -10000
#define WARNING_BASE                    -20000
/*
  以下定义警告代码
 */
#define DB_SQL_ERROR                          (WARNING_BASE - 0 )
#define CAN_NOT_OPEN_DRV_SQL_SCRIPT           (WARNING_BASE - 1 )
#define DB_SQL_EXEC_ERROR                     (WARNING_BASE - 2 )
#define DB_FETCH_DATA_ERROR                   (WARNING_BASE - 3 )
#define SYS_VAR_TABLE_ALREADY_EXIST           (WARNING_BASE - 4 )
#define ERROR_NO_LED_DEV                      (WARNING_BASE - 5 )
#define NOT_SUPORTED                          (WARNING_BASE - 6 )
#define REG_OUTOF_RANGE                       (WARNING_BASE - 7 )
#define REG_DATA_PACKAGE_ERROR                (WARNING_BASE - 8 )
#define DEV_ALREADY_REG                       (WARNING_BASE - 9 )
#define OUT_OF_CMD_BUFFER_SIZE                (WARNING_BASE - 10 )
#define HMI_COM_DATA_NULL                     (WARNING_BASE - 11 )
#define HMI_COM_LEN_ZERO                      (WARNING_BASE - 12 )
#define FX_CMD_NOT_SUPPORT                    (WARNING_BASE - 13 )
#define HMI_PASER_BUFF_NOT_INIT               (WARNING_BASE - 14 )
#define HMI_CMD_NOT_SUPPORT                   (WARNING_BASE - 15 )
#define HMI_VERIFY_CHECK_FAIL                 (WARNING_BASE - 16 )
#define HMI_REG_TYPE_NOT_SUPPORTED            (WARNING_BASE - 17 )
#define HMI_REG_ADDRESS_OVERFLOW              (WARNING_BASE - 18 )
#define HMI_DATA_COUNT_ERROR                  (WARNING_BASE - 19 )
#define SMART_X_DATA_ERROR                    (WARNING_BASE - 20 )
#define SMART_GRAMMA_ERROR                    (WARNING_BASE - 21 )
#define SMART_FD_ERROR                        (WARNING_BASE - 22 )
#define SMART_Y_ADDRESS_OVERFLOW              (WARNING_BASE - 23 )
#define CAN_NOT_INIT_HMI_PORT				  (WARNING_BASE - 24 )
#define CAN_NOT_FIND_HMI					  (WARNING_BASE - 25 )
#define CAN_NOT_INIT_HMI					  (WARNING_BASE - 26 )
#define ERROR_DB_ID                           (WARNING_BASE - 27 )
/*
  以下定义错误代码
 */
#define ERR_NOT_CONN                          (ERROR_BASE - 1 )
#define VAR_EXISTED                           (ERROR_BASE - 2 )
#define VAR_NO_EXISTED                        (ERROR_BASE - 3 )
#define VAR_NULL_BLOB_DATA                    (ERROR_BASE - 4 )
#define NO_DEV_NAME                           (ERROR_BASE - 5 )
#define DEV_NAME_EXISTED                      (ERROR_BASE - 6 )
#define DEV_NOT_EXIST                         (ERROR_BASE - 7 )
#define DEV_NOT_INSTALL                       (ERROR_BASE - 8 )
#define MD5_STRING_NULL                       (ERROR_BASE - 9 )
#define USER_EXISTED                          (ERROR_BASE - 10 )
#define USER_NOT_EXIST                        (ERROR_BASE - 11 )
#define USER_PASSWD_ERR                       (ERROR_BASE - 12 )
#define STRING_EMPTY                          (ERROR_BASE - 13 )
#define DATA_TYPE_NOT_MATCH                   (ERROR_BASE - 14 )
#define _NO_DATA_                             (ERROR_BASE - 15 )
#define CMD_PACKAGE_LEN_ERR                   (ERROR_BASE -16 )
#define CMD_CRC_ERR                           (ERROR_BASE - 17 )
#define FEED_PACKAGE_LEN_ERR                  (ERROR_BASE - 18 )
#define FEED_CRC_ERR                          (ERROR_BASE - 19 )
#define CTRL_HEART_LEN_ERR                    (ERROR_BASE - 20 )
#define CTRL_HEART_CRC_ERR                    (ERROR_BASE - 21 )
#define OPEN_SERIAL_ERR                       (ERROR_BASE - 22 )
#define SERIAL_NOT_INIT                       (ERROR_BASE - 23 )
#define _3G_DEV_NOT_EXIST                     (ERROR_BASE - 24 )
#define PDU_SCA_ADD_NULL                      (ERROR_BASE - 25 )
#define PDU_DATA_LEN_TOO_SHORT                (ERROR_BASE - 26 )
#define _3G_IMEI_FAULT                        (ERROR_BASE - 27 )
#define SMS_SEND_FAILURE                      (ERROR_BASE - 28 )
#define PDU_TO_RAW_FAILURE                    (ERROR_BASE - 29 )
#define SYS_SCA_NULL                          (ERROR_BASE - 30 )
#define INIT_VP_ERROR                         (ERROR_BASE - 31 )
#define INIT_DA_OA_ERROR                      (ERROR_BASE - 32 )
#define INIT_SCA_ERROR                        (ERROR_BASE - 33 )
#define SET_SIM_SCA_ERROR                     (ERROR_BASE - 34 )
#define SET_DB_SCA_ERROR                      (ERROR_BASE - 35 )
#define SET_3G_ECHO_FAILURE                   (ERROR_BASE - 36 )
#define SET_3G_CHARSET_FAILURE                (ERROR_BASE - 37 )
#define SET_SMS_SERVICE_FAILURE               (ERROR_BASE - 38 )
#define SET_SMS_SPEC_FAILURE                  (ERROR_BASE - 39 )
#define BUZZER_DRV_FAILURE                    (ERROR_BASE - 40 )
#define HEART_RAW_NULL                        (ERROR_BASE - 41 )
#define HEART_RAW_LEN_ERROR                   (ERROR_BASE - 42 )
#define HEART_RAW_MEM_LOW                     (ERROR_BASE - 43 )
#define MAKE_RAW_HEART_FAILURE                (ERROR_BASE - 44 )
#define CAN_NOT_EXEC_PLC_CMD_CTRL             (ERROR_BASE - 45 )
#define PLC_CMD_ALREADY_RUN                   (ERROR_BASE - 46)
#define PLC_CMD_LEN_ERROR                     (ERROR_BASE - 47 )
#define PLC_CMD_HEAD_LEN_ERROR                (ERROR_BASE - 48 )
#define PLC_CMD_READ_LEN_ERROR                (ERROR_BASE - 49 )
#define PLC_CMD_DATA_NULL                     (ERROR_BASE - 50 )
#define PLC_CMD_FEEDBACK_NULL                 (ERROR_BASE - 51 )
#define PHONE_CODE_EMPTY                      (ERROR_BASE - 52 )
#define PHONE_CODE_ERR                        (ERROR_BASE - 53 )
#define BUZZER_OPE_ERROR                      (ERROR_BASE - 54 )
#define CAN_NOT_CRATE_DEV_TABLE               (ERROR_BASE - 55 )
#define PROTOCOL_REGISTED                     (ERROR_BASE - 56 )
#define PROTOCOL_NOT_REGISTED                 (ERROR_BASE - 57 )
#define PLC_CMD_READ_ERROR                    (ERROR_BASE - 58 )
#define CMD_INTER_FACE_NOT_INIT               (ERROR_BASE - 59 )
#define CMD_NOT_EXIST                         (ERROR_BASE - 60 )
#define SET_CMD_DATA_ERROR                    (ERROR_BASE - 61 )
#define CMD_GRAMMER_ERROR                     (ERROR_BASE - 62 )
#define BAUD_NOT_SUPPORT                      (ERROR_BASE - 63 )
#define STOP_BIT_NOT_SUPPORT                  (ERROR_BASE - 64 )
#define PARITY_TYPE_NOT_SUPPORT               (ERROR_BASE - 65 )
#define CHAR_LEN_NOT_SUPPORT                  (ERROR_BASE - 66 )
#define CMD_PARAM_NOT_SUPPORT                 (ERROR_BASE - 67 )
#define NEED_DEV_ADDRESS                      (ERROR_BASE - 68 )
#define NO_SERVICE_PORT                       (ERROR_BASE - 69 )
#define SERVICE_IS_RUNING                     (ERROR_BASE - 70 )
#define CAN_NOT_START_CTRL_THREAD             (ERROR_BASE - 71 )
#define NOT_CONNECT_SERVER                    (ERROR_BASE - 72 )
#define CAN_NOT_CONNECT_DATA_SERVER           (ERROR_BASE - 73 )
#define REG_DEV_ADDRESS_ERROR                 (ERROR_BASE - 74 )
#define DATA_CONN_SYSTEM_ERROR                (ERROR_BASE - 75 )
#define SERVER_VAR_DEFINES_ERROR              (ERROR_BASE - 76 )
#define CAN_NOT_FIND_USR_SERVER               (ERROR_BASE - 77 )
#define DATA_VAR_NOT_INIT                     (ERROR_BASE - 78 )
#define CAN_NOT_FIND_DATA_SERVER              (ERROR_BASE - 79 )
#define SYS_VAR_INIT_FILE_NOT_EXIST           (ERROR_BASE - 80 )
#define SYS_VAR_INIT_FILE_FAULT               (ERROR_BASE - 81 )
#define SYS_VAR_INIT_DATA_FAULT               (ERROR_BASE - 82 )
#define SEND_SERIAL_DATA_ERROR		          (ERROR_BASE - 83 )
#define CTRL_DEV_NOT_REGISTERED               (ERROR_BASE - 84 )
#define ERROR_CMD_NOT_SUPPORT                 (ERROR_BASE - 85 )
#define CTRL_DATA_NOT_READY                   (ERROR_BASE - 86 )
#define CAN_NOT_FIND_UNMAP_X                  (ERROR_BASE - 87 )
#define CAN_NOT_FIND_UNMAP_Y                  (ERROR_BASE - 88 )
#define CAN_NOT_FIND_UNMAP_D8                 (ERROR_BASE - 89 )
#define CAN_NOT_FIND_UNMAP_D16                (ERROR_BASE - 90 )
#define CAN_NOT_FIND_UNMAP_D32                (ERROR_BASE - 91 )
#define CAN_NOT_FIND_UNMAP_D64                (ERROR_BASE - 92 )
#define CAN_NOT_FIND_UNMAP_FD                 (ERROR_BASE - 93 )
#define CAN_NOT_FIND_UNMAP_M                  (ERROR_BASE - 94 )
#define CAN_NOT_FIND_UNMAP_FFD                (ERROR_BASE - 95 )
#define DATA_BASE_NOT_READY                   (ERROR_BASE - 96 )
#define DATA_OUT_OF_RANGE                     (ERROR_BASE - 97 )
#define SIM_CARD_NOT_EXIST                    (ERROR_BASE - 98 )
#define REG_SIM_CARD_ERROR                    (ERROR_BASE - 99 )
#define _3G_SYS_VAR_NOT_EIXST                 (ERROR_BASE - 100 )
#define SMART_CRC_ERROR                       (ERROR_BASE - 101 )
#define CMD_DATA_BUFFER_NULL                  (ERROR_BASE - 102 )
#define PLC_TRANS_DATA_LOSE                   (ERROR_BASE - 103 )
#define PLC_TRANS_IS_RUNING                   (ERROR_BASE - 104 )
#define YANZHAO_REG_NOT_EXIST                 (ERROR_BASE - 105 )
#define YANZHAO_REG_CAN_NOT__WRITE            (ERROR_BASE - 106 )
#define PLC_CTRL_NOT_INIT                     (ERROR_BASE - 107 )
#define USR_DATA_SVR_URL_NULL                 (ERROR_BASE - 108 )
/*网络数据发送发生数据丢失*/
#define NET_SEND_LOSE_DATA                    (ERROR_BASE - 109 )
#define CAN_NOT_OPEN_SERIAL_PORT              (ERROR_BASE - 110 )
#define CRC_CHECK_ERROR                       (ERROR_BASE - 111 )
#define MISSING_PHONE_NUMBER                  (ERROR_BASE - 112 )
#define CAN_NOT_INIT_RS485                    (ERROR_BASE - 113 )
#define RS485_PORT_NOT_INIT                   (ERROR_BASE - 114 )
#define NULL_POINTER					  	  (ERROR_BASE - 115 )
#define SYSVAR_NO_VALUE						  (ERROR_BASE - 116 )
/*
  以下定义致命错误代码
 */
#define FATAL_NO_MEM                               (FATAL_BASE - 0 )
#define FATAL_BAD_PORT                             (FATAL_BASE - 1 )
#define FATAL_MISSING_USER_NAME                    (FATAL_BASE - 2 )
#define FATAL_CONNECTED_DEV_NULL                   (FATAL_BASE - 3 )
#define FATAL_MAKE_TCP_CONNECTION                  (FATAL_BASE - 4 )
#define FATAL_XML_FORMAT                           (FATAL_BASE - 5 )
#define FATAL_SERIAL_PORT_OPEN                     (FATAL_BASE - 6 )
#define RF_CARD_NOT_INIT                           (FATAL_BASE - 7 )
#define FATAL_INIT_SERVER_NAME                     (FATAL_BASE - 8 )
#define FATAL_INIT_HEART                           (FATAL_BASE - 9 )
#define FATAL_HEART_LOSE                           (FATAL_BASE - 10)
#define FATAL_INIT_PLC                             (FATAL_BASE - 11 )
#define FATAL_INIT_SOCKET                          (FATAL_BASE - 12 )
#define PROTOCOL_NOT_EXISTED                       (FATAL_BASE - 13 )
#define MISSING_PTL_FILE_NAME                      (FATAL_BASE - 14 )
#define CAN_NOT_OPEN_DRV_FILE                      (FATAL_BASE - 15 )
#define DRV_TABLE_NULL                             (FATAL_BASE - 16 )
#define CAN_NOT_INIT_FREETDS                       (FATAL_BASE - 17 )
#define CAN_NOT_INIT_FREETDS_LOGIN                 (FATAL_BASE - 18 )
#define CAN_NOT_CONNECT_DB_SERVER                  (FATAL_BASE - 19 )
#define SERVER_DB_NOT_INIT                         (FATAL_BASE - 20 )
#define CAN_NOT_INIT_RF_CTRL                       (FATAL_BASE - 21 )
#define CAN_NOT_INIT_PLC_CMD                       (FATAL_BASE - 22 )
#define FATAL_SOFT_DEV_M_NOT_READY                 (FATAL_BASE - 23 )
#define FATAL_SOFT_DEV_X_NOT_READY                 (FATAL_BASE - 24 )
#define FATAL_SOFT_DEV_Y_NOT_READY                 (FATAL_BASE - 25 )
#define FATAL_SOFT_DEV_D8_NOT_READY                (FATAL_BASE - 26 )
#define FATAL_SOFT_DEV_D16_NOT_READY               (FATAL_BASE - 27 )
#define FATAL_SOFT_DEV_D32_NOT_READY               (FATAL_BASE - 28 )
#define FATAL_SOFT_DEV_D64_NOT_READY               (FATAL_BASE - 29 )
#define FATAL_SOFT_DEV_FD_NOT_READY                (FATAL_BASE - 30 )
#define FATAL_SOFT_DEV_FFD_NOT_READY               (FATAL_BASE - 31 )
#define FATAL_SOFT_DEV_XD8_NOT_READY               (FATAL_BASE - 32 )
#define FATAL_SOFT_DEV_YD8_NOT_READY               (FATAL_BASE - 33 )
#define FATAL_SOFT_DEV_XD16_NOT_READY              (FATAL_BASE - 34 )
#define FATAL_SOFT_DEV_YD16_NOT_READY              (FATAL_BASE - 35 )
#define FATAL_SOFT_DEV_XD32_NOT_READY              (FATAL_BASE - 36 )
#define FATAL_SOFT_DEV_YD32_NOT_READY              (FATAL_BASE - 37 )
#define FATAL_SOFT_DEV_XFD_NOT_READY               (FATAL_BASE - 38 )
#define FATAL_SOFT_DEV_YFD_NOT_READY               (FATAL_BASE - 39 )
#define FATAL_SOFT_DEV_XFFD_NOT_READY              (FATAL_BASE - 40 )
#define FATAL_SOFT_DEV_YFFD_NOT_READY              (FATAL_BASE - 41 )
#define FATAL_SOFT_DEV_SD8_NOT_READY               (FATAL_BASE - 42 )
#define FATAL_SOFT_DEV_SD16_NOT_READY              (FATAL_BASE - 43 )
#define FATAL_SOFT_DEV_SD32_NOT_READY              (FATAL_BASE - 44)
#define FATAL_SOFT_DEV_T_NOT_READY                 (FATAL_BASE - 45 )
#define FATAL_SOFT_DEV_C16_NOT_READY               (FATAL_BASE - 46 )
#define FATAL_SOFT_DEV_C32_NOT_READY               (FATAL_BASE - 47 )
#define FATAL_PLC_IMG_NULL                         (FATAL_BASE - 48 )
#define FATAL_DEV_CTRL_DESC_NULL                   (FATAL_BASE - 49 )
#define CAN_NOT_INIT_PLC_CTRL                      (FATAL_BASE - 50 )
#define CAN_NOT_OPEN_HARD_DESC_SQL_SCRIPT          (FATAL_BASE - 51 )
#define DB_BIND_ERROR                              (FATAL_BASE - 52 )
#define SYSTEM_ERROR                               (FATAL_BASE - 53 )
#define PORT_ALREAY_USEING                         (FATAL_BASE - 54 )
#define CAN_NOT_OPEN_IMG_SQL_SCRIPT                (FATAL_BASE - 54 )
#define HARD_DESC_SCRIPT_NOT_EXIST                 (FATAL_BASE - 55 )
#define HARD_CTRL_DESC_DB_NOT_INIT                 (FATAL_BASE - 56 )
#define FATAL_DRV_LOAD_NOT_INIT                    (FATAL_BASE - 57 )
#define FATAL_SERVER_LOST                          (FATAL_BASE - 58 )
/* 装入系统设置变量发生错误 */
#define LOAD_SETTING_VAR_ERROR                     (FATAL_BASE - 59 )
// 无法再找到可以映射的软元件了，说明软元件初始化的数量不足
#define  CAN_NOT_FIND_SOFT_DEV			   (FATAL_BASE - 60 )
#define ARRAY_OVERFLOW                             (FATAL_BASE - 61 )
#define FATAL_SRC_FILE_EMPTY                       (FATAL_BASE - 62 )
#define FATAL_SRC_FILE_FORMAT                      (FATAL_BASE - 63 )
#define FATAL_NULL_POINTER                         (FATAL_BASE - 64 )
#define FATAL_BAD_URL                              (FATAL_BASE - 65 )
#endif
